;Person A:	Jim McAllister
;			cs61a-cs
;Person B:	Yunliang Li
;           cs61a-et
;	Section 20
;	proj3b


;;;  Data for adventure game.  This file is adv-world.scm

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; setting up the world
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(define Soda (instantiate place 'Soda))
(define BH-Office (instantiate place 'BH-Office))
(define MJC-Office (instantiate place 'MJC-Office))
(define art-gallery (instantiate place 'art-gallery))
(define Pimentel (instantiate place 'Pimentel))
(define 61A-Lab (instantiate place '61A-Lab))
(define Sproul-Plaza (instantiate place 'Sproul-Plaza))
(define Telegraph-Ave (instantiate place 'Telegraph-Ave))
(define Noahs (instantiate restaurant 'Noahs bagel 1.00))
(define Intermezzo (instantiate restaurant 'Intermezzo coffee 1.50))
(define s-h (instantiate place 'sproul-hall))
(define Stadium (instantiate place 'Stadium))
(define Kirin (instantiate place 'Kirin))
(define Campanille (instantiate place 'Campanille))
(define Hearst-garage (instantiate garage 'Hearst-garage)) 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; B6a add place "jail"
(define jail (instantiate place 'jail)) 


(can-go Soda 'up art-gallery)
(can-go art-gallery 'down Soda)
(can-go art-gallery 'west BH-Office)
(can-go BH-Office 'east art-gallery)
(can-go art-gallery 'east MJC-Office)
(can-go MJC-office 'west art-gallery)
(can-go Soda 'south Pimentel)
(can-go Pimentel 'north Soda)
(can-go Pimentel 'south 61A-Lab)
(can-go 61A-Lab 'north Pimentel)
(can-go 61A-Lab 'west s-h)
(can-go s-h 'east 61A-Lab)
(can-go Sproul-Plaza 'east s-h)
(can-go s-h 'west Sproul-Plaza)
(can-go Sproul-Plaza 'north Pimentel)
(can-go Sproul-Plaza 'south Telegraph-Ave)
(can-go Telegraph-Ave 'north Sproul-Plaza)
(can-go Telegraph-Ave 'south Noahs)
(can-go Noahs 'north Telegraph-Ave)
(can-go Noahs 'south Intermezzo)
(can-go Intermezzo 'north Noahs)
(can-go Stadium 'west Pimentel)
(can-go Pimentel 'east Stadium)
(can-go Kirin 'south Soda)
(can-go Soda 'north Kirin)
(can-go Campanille 'east Pimentel)
(can-go Campanille 'south Sproul-Plaza)
(can-go Campanille 'north Soda)
(can-go Pimentel 'west Campanille)
(can-go Soda 'west Hearst-garage)
(can-go Hearst-garage 'east Soda)



;; Some people.
; MOVED above the add-entry-procedure stuff, to avoid the "The computers
; seem to be down" message that would occur when hacker enters 61a-lab
; -- Ryan Stejskal
(define singer (instantiate person 'rick sproul-plaza))
(ask singer 'set-talk "My funny valentine, sweet comic valentine")
(define preacher (instantiate person 'preacher sproul-plaza))
(ask preacher 'set-talk "Praise the Lord")
(define street-person (instantiate person 'harry telegraph-ave))
(ask street-person 'set-talk "Brother, can you spare a buck")
(define Brian (instantiate person 'Brian BH-Office))
(define hacker (instantiate person 'hacker 61A-lab))
(define nasty (instantiate thief 'nasty sproul-plaza))
(define oski (instantiate person 'Oski Stadium))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define johnny (instantiate police 'johnny art-gallery))

(define (make-count)
	(let ((result 0))
		(lambda ()
			(set! result (+ result 1))
			result)))
			
(define s-h-exit-count (make-count))
(define (sproul-hall-exit)
	(if (> (s-h-exit-count) 3)
					(print "Have a nice day")
					(error "You can check out any time you'd like, but you can never leave")))


(define (bh-office-exit)
  (print "What's your favorite programming language?")
  (let ((answer (read)))
    (if (eq? answer 'scheme)
	(print "Good answer, but my favorite is Logo!")
	(begin (newline) (bh-office-exit)))))
    

(ask s-h 'add-entry-procedure
 (lambda () (print "Miles and miles of students are waiting in line...")))
(ask s-h 'add-exit-procedure sproul-hall-exit)
(ask BH-Office 'add-exit-procedure bh-office-exit)
(ask Noahs 'add-entry-procedure
 (lambda () (print "Would you like lox with it?")))
(ask Noahs 'add-exit-procedure
 (lambda () (print "How about a cinnamon raisin bagel for dessert?")))
(ask Telegraph-Ave 'add-entry-procedure
 (lambda () (print "There are tie-dyed shirts as far as you can see...")))
(ask 61A-Lab 'add-entry-procedure
 (lambda () (print "The computers seem to be down")))
(ask 61A-Lab 'add-exit-procedure
 (lambda () (print "The workstations come back to life just in time.")))

;; Some things.

;(define bagel (instantiate thing 'bagel))
;(ask Noahs 'appear bagel)

;(define coffee (instantiate thing 'coffee))
;(ask Intermezzo 'appear coffee)

;(define potsticker (instantiate thing 'potsticker))
;(ask Kirin 'appear potsticker)

(define my-car (instantiate thing 'my-car))
(ask hearst-garage 'appear my-car)
;; Q1
;okay
;STk> (ask oski 'exits)
;(west)
;STk> (ask oski 'go 'west)


;oski moved from stadium to pimentel
;appeared
;STk> (ask oski go north)
;*** Error:
;    unbound variable: north
;Current eval stack:
;__________________
;  0    (ask oski go north)
;STk> (ask oski 'go 'north)


;oski moved from pimentel to soda
;appeared
;STk> (ask oski 'go 'north)


;oski moved from soda to kirin
;appeared
;STk> (ask oski 'look-around)
;(potsticker)
;STk> (ask oski 'take potsticker)

;oski took potsticker
;taken
;STk> (ask oski 'look-around)
;(potsticker)
;STk> (ask oski 'go 'south)


;oski moved from kirin to soda
;appeared
;STk> (ask oski 'go 'up)


;oski moved from soda to art-gallery
;appeared
;STk> (ask oski 'go 'west)


;oski moved from art-gallery to bh-office
;appeared
;STk> (ask oski 'look-around)
;(potsticker brian)
;STk> (ask oski 'lose potsticker)
;lost
;STk> (ask brain 'take potsticker)
;*** Error:
;    unbound variable: brain
;Current eval stack:
;__________________
;  0    (ask brain (quote take) potsticker)
;STk> (ask brian 'take potsticker)

;brian took potsticker
;taken
;STk> (ask oski 'go 'east)
;"What's your favorite programming language?"

;Spanish

;"What's your favorite programming language?"
;Pascal

;"What's your favorite programming language?"
;Fortran

;"What's your favorite programming language?"
;Scheme
;"Good answer, but my favorite is Logo!"


;oski moved from bh-office to art-gallery
;appeared
;STk> (ask oski 'go down)
;*** Error:
;    unbound variable: down
;Current eval stack:
;__________________
;  0    (ask oski (quote go) down)
;STk> (ask oski 'go 'down)


;oski moved from art-gallery to soda
;appeared
;STk> (ask oski 'go 'south)


;oski moved from soda to pimentel
;appeared
;STk> (ask oski 'go 'south)


;oski moved from pimentel to 61a-lab
;"The computers seem to be down"
;appeared
;STk> (ask oski 'work)
;*** Error:
;    No method work in class person
;Current eval stack:
;__________________
;  0    (apply stk-error args)
;STk> (transcript-off)

;; Q2a
; procedure

;; Q2b
; type
; neighbors
; exits
; look-in
; appear
; enter
; gone
; exit
; new-neighbor
; add-entry-procedure
; add-exit-procedre
; remove-entry-procedure
; remove-exit-procedure
; clear-all-procs

;; Q2c
; >(ask brian 'place) -> procedure
;		returns procedure that is returned by the place where brian is located
;		although 'place is not a method for the person class, there are two 
;		implicit variables ('name and 'place) that are created when the object
;		is instantiated.
; >(let ((where (ask brian 'place))) (ask where 'name)) -> Peoples-Park
;		as noted above, (ask brian 'place) returns the procedure for place;
;		when you then ask for name, you get the name of the place.
; >(ask Peoples-park 'appear bagel) -> error
;		Peoples-park is the 'formal name' of an "anonymous object"

;; Q2d
; (ask 61a-lab 'appear computer) is the correct form; we want to pass the object
; to the appear method.
; >(computer 'name) -> procedure
;		returns the procedure for the name dispatch procedure from the thing procedure
;		that is represented by computer.

;; Q2e
;(define-class (thing name)
;	(instance-vars
;		(possessor 'no-one))
;	(method (send-usual-to-parent)
;		(error "Can't use USUAL without a parent." 'thing))
;	(method (type) 'thing)
;	(method (change-possessor new-possessor)
;		(set! possessor new-possessor)))		

;; Q2f
(define (name obj) (ask obj 'name))
(define (inventory obj)
	(if (person? obj)
		(map name (ask obj 'possessions))
		(map name (ask obj 'things))))
(define (whereis obj) 
	(if (person? obj)
		(ask (ask obj 'place) 'name)
		'(Where ever you go, there you are)))
(define (owner obj)
	(if (thing? obj)
		(ask obj 'possessor)
		'(I cannot be owned)))
		
;; Q A4a

;okay
;STk> (ask oski 'go 'west)


;oski moved from stadium to pimentel
;appeared
;STk> (ask oski 'go 'west)


;oski moved from pimentel to campanille
;appeared
;STk> (ask oski 'go 'south)


;oski moved from campanille to sproul-plaza
;"Praise the Lord"
;"My funny valentine, sweet comic valentine"
;appeared
;STk> (ask oski 'go 'south)


;oski moved from sproul-plaza to telegraph-ave
;"There are tie-dyed shirts as far as you can see..."
;"Brother, can you spare a buck"
;appeared
;STk> (transcript-off)

;; Q A4b
;okay
;STk> (define student-store (instantiate locked-place 'student-store))
;student-store
;STk> (can-go sproul-plaza 'west student-store)
;connected
;STk> (can-go student-store 'east sproul-plaza)
;connected
;STk> (ask oski 'go 'west)


;oski moved from stadium to pimentel
;appeared
;STk> (ask oski 'go 'west)


;oski moved from pimentel to campanille
;appeared
;STk> (ask oski 'go 'south)


;oski moved from campanille to sproul-plaza
;"Praise the Lord"
;"My funny valentine, sweet comic valentine"
;appeared
;STk> (ask oski 'go 'west)
;"The entry is locked"
;okay
;STk> (ask student-store 'unlock)
;"Unlocked"
;okay
;STk> (ask oski 'go 'west)


;oski moved from sproul-plaza to student-store
;appeared
;STk> (ask oski 'go 'east)


;oski moved from student-store to sproul-plaza
;"Praise the Lord"
;"My funny valentine, sweet comic valentine"
;appeared
;STk> (transcript-off)
(define barney (instantiate person 'barney hearst-garage))

;; QB3
;/home/aa/projects/scheme/lib/stk/4.0.1-ucb1.16/SunOS-5.9-sun4/stk -load /home/aa/projects/scheme/lib/stk/site-scheme/load-simply
;Welcome to the STk interpreter version 4.0.1-ucb1.16 [SunOS-5.9-sun4]
;Copyright (c) 1993-1999 Erick Gallesio - I3S - CNRS / ESSI <eg@unice.fr>
;Modifications by UCB EECS Instructional Support Group
;Questions, comments, or bug reports to <inst@EECS.Berkeley.EDU>.
;STk> (load "obj.scm")
;okay
;STk> (load "adv.scm")
;okay
;STk> (load "tables.scm")
;okay
;STk> (load "adv-world.scm")
;okay
;STk> (define tea (instantiate thing 'tea))
;tea
;STk> (define moca (instantiate thing 'moca))
;moca
;STk> (define coke (instantiate thing 'coke))
;coke
;STk> (ask bh-office 'appear tea)
;appeared
;STk> (ask bh-office 'appear moca)
;appeared
;STk> (ask bh-office 'appear coke)
;appeared
;STk> (ask hacker 'go 'north)
;"The workstations come back to life just in time."


;hacker moved from 61a-lab to pimentel
;appeared
;STk> (ask hacker 'go 'north)


;hacker moved from pimentel to soda
;appeared
;STk> (ask hacker 'go 'up)


;hacker moved from soda to art-gallery
;appeared
;STk> (ask hacker 'go 'west)


;hacker moved from art-gallery to bh-office
;appeared
;STk> (ask hacker 'look-around)
;(coke moca tea brian)
;STk> (ask brian 'take tea)

;brian took tea
;taken
;STk> (ask hacker 'take-all)

;hacker took coke

;hacker took moca

;can't take teaokay


;; Q B4a. 
;1. add a new class "basic-object" with an object "properties" (a table obj).
;2. add parent class "basic-object" to class "place", "person", and "thing").
;3. initialize every person object has 100 strengh.

;STk> (ask brian 'strength)
;100
;STk> (ask hacker 'strenght)
;#f
;STk> (ask hacker 'strengh)
;#f
;STk> (ask hacker 'strength)
;100
;STk> 

;; Q B4b. 
;1. add method PERSON? to person class.
;2. repeat 1. for thing and place class.
;3. redefine the original person?, thing? and place predicate.
;STk> (person? brian)
;#t
;STk> (person? bh-office)
;#f
;STk> (thing? brian)
;#f
;STk> (thing? coffee)
;#t
;STk> (place? coffee)
;#f
;STk> (place bh-office)
;*** Error:
;    Bad message to class#[closure arglist=(message) 1d57c0]
;Current eval stack:
;__________________
;  0    (apply stk-error args)
;STk> (place? bh-office)
;#t
;STk> 


;; Q B5.
;1. add class hotspot.
;2. add class laptop.

;/home/aa/projects/scheme/lib/stk/4.0.1-ucb1.16/SunOS-5.9-sun4/stk -load /home/aa/projects/scheme/lib/stk/site-scheme/load-simply
;Welcome to the STk interpreter version 4.0.1-ucb1.16 [SunOS-5.9-sun4]
;Copyright (c) 1993-1999 Erick Gallesio - I3S - CNRS / ESSI <eg@unice.fr>
;Modifications by UCB EECS Instructional Support Group
;Questions, comments, or bug reports to <inst@EECS.Berkeley.EDU>.
;STk> (load "obj.scm")
;okay
;STk> (load "adv.scm")
;okay
;STk> (load "tables.scm")
;okay
;STk> (load "adv-world.scm")
;okay
;STk> (define hs (instantiate hotspot 'hs 'password))
;hs
;STk> (define mac (instantiate laptop 'mac))
;mac
;STk> (define pc (instantiate laptop 'pc))
;pc
;STk> (ask hs 'appear mac)
;appeared
;STk> (ask hs 'appear pc)
;appeared
;STk> (can-go bh-office 'tele hs)
;connected
;STk> (ask brian 'go 'tele)
;"What's your favorite programming language?"
;scheme
;"Good answer, but my favorite is Logo!"


;brian moved from bh-office to hs
;appeared
;STk> (ask brian 'look-around)
;(pc mac)
;STk> (ask brian 'take mac)

;brian took mac
;taken
;STk> (ask mac 'connect 'open-sesame)
;The password is incorrect.

;okay
;STk> (ask mac 'connect 'password)
;Connection Successful
;okay
;STk> (ask hotspot 'connect pc 'pass)
;*** Error:
;    Bad message to classconnect
;Current eval stack:
;__________________
;  0    (apply stk-error args)
;  1    (let ((method (object message))) (if (method? method) (apply method args) (error "No method " message " in class " (cadr method))))
;STk> (ask hs 'connect pc 'pass)
;The password is incorrect.

;okay
;STk> (ask hs 'connect pc 'password)
;Connection Successful
;okay
;STk> (ask mac 'surf "http://www.cs.berkeley.edu")


;  Your Terminal type is unknown!

;  Enter a terminal type: [vt100] a

;TERMINAL TYPE IS SET TO a
;Terminal initialisation failed - unknown terminal type?
;256
;STK>

#|
okay
STk> (load "load-adv")
"My funny valentine, sweet comic valentine"
"There are tie-dyed shirts as far as you can see..."

oski took bagel

oski took bagel
okay
STk> (ask oksi 'strength)
*** Error:
    unbound variable: oksi
Current eval stack:
__________________
  0    (ask oksi (quote strength))
STk> (ask oski 'strength)
100
STk> (ask oski 'money)
100
STk> (inventory oski)
(bagel bagel)
STk> (map (lambda (x) (ask x 'calories)) (inventory oski))
*** Error:
    eval: bad function in : (object message)
Current eval stack:
__________________
  0    (object message)
  1    (let ((method (object message))) (if (method? method) (apply method args) (error "No method " message " in class " (cadr method))))
  2    (map (lambda (x) (ask x (quote calories))) (inventory oski))
STk> (ask b1 'calories)
100
STk> (ask b2 calories)
*** Error:
    unbound variable: calories
Current eval stack:
__________________
  0    (ask b2 calories)
STk> (ask b2 'calories)
100
STk> (ask oski 'eat)
"yum, yum..."
"yum, yum..."
(okay okay)
STk> (inventory oski)
()
STk> (ask oski 'strength)
300
STk> (move-loop oski)

(west)
?  > 
west


oski moved from stadium to pimentel
appeared

(west east south north)
?  > west


oski moved from pimentel to campanille
appeared

(north south east)
?  > south


oski moved from campanille to sproul-plaza
"Praise the Lord"
"My funny valentine, sweet comic valentine"
appeared

(south north east)
?  > south


oski moved from sproul-plaza to telegraph-ave
"There are tie-dyed shirts as far as you can see..."
"Brother, can you spare a buck"
appeared

(south north)
?  > south


oski moved from telegraph-ave to noahs
"Would you like lox with it?"
appeared

(south north)
?  > stop

okay
STk> (ask oski 'buy 'bagel)

oski took bagel
taken
STk> (inventory oski)
(bagel)
STk> (ask oski 'money)
99.0
STk> (ask oski 'go 'south)
"How about a cinnamon raisin bagel for dessert?"


oski moved from noahs to intermezzo
appeared
STk> (ask oski 'buy 'coffee)

oski took coffee
taken
STk> (ask oski 'money)
97.5
STk> (inventory oski)
(coffee bagel)
STk> (define ipod (instantiate thing 'ipod))
ipod
STk> (ask intermezzo 'appear ipod)
appeared
STk> (ask oski 'take ipod)

oski took ipod
taken
STk> (inventory oski)
(ipod coffee bagel)
STk> (ask oski 'eat)
"yum, yum..."
"yum, yum..."
(okay okay)
STk> (inventory oski)
(ipod)
STk> (ask oski 'strength)
425
STk> (transcript-off)
|#
#|
Question B6a.

/home/aa/projects/scheme/lib/stk/4.0.1-ucb1.16/SunOS-5.9-sun4/stk -load /home/aa/projects/scheme/lib/stk/site-scheme/load-simply
Welcome to the STk interpreter version 4.0.1-ucb1.16 [SunOS-5.9-sun4]
Copyright (c) 1993-1999 Erick Gallesio - I3S - CNRS / ESSI <eg@unice.fr>
Modifications by UCB EECS Instructional Support Group
Questions, comments, or bug reports to <inst@EECS.Berkeley.EDU>.
STk> (load "obj.scm")
okay
STk> (load "adv.scm")
okay
STk> (load "tables.scm")
okay
STk> (load "adv-world.scm")
"My funny valentine, sweet comic valentine"
"There are tie-dyed shirts as far as you can see..."

oski took bagel

oski took bagel
okay
STk> (define cake (instantiate food 'cake))
cake
STk> (ask (ask brian 'place) 'name)
bh-office
STk> (ask bh-office 'appear cake)
appeared
STk> (ask (ask brian 'place) 'name)
bh-office
STk> (ask brian 'look-around)
(cake)
STk> (ask brian 'take cake)

brian took cake
taken
STk> (ask (ask nasty 'place) 'name)
sproul-plaza
STk> (ask nasty 'go-directly-to bh-office)


nasty moved from sproul-plaza to bh-office
""
appeared
STk> (ask brian 'look-around)
(cake nasty)
STk> (ask nasty 'notice brian)

nasty took cake

Yaaah! brian is upset!
"What's your favorite programming language?"
scheme
"Good answer, but my favorite is Logo!"


nasty moved from bh-office to art-gallery
appeared


Question B6b


STk> (load "obj.scm")
okay
STk> (load "adv.scm")
*** Error at line 502 of file ./adv.scm:
    read: End of file inside list
Current eval stack:
__________________
  0    (load "adv.scm")
STk> (load "obj.scm")
okay
STk> (load "adv.scm")
okay
STk> (load "tables.scm")
okay
STk> (load "adv-world.scm")
"My funny valentine, sweet comic valentine"
"There are tie-dyed shirts as far as you can see..."

oski took bagel

oski took bagel
okay
STk> (define cake (instantiate food 'cake))
cake
STk> (ask bh-office 'appear cake)
appeared
STk> (ask brian 'take cake)

brian took cake
taken
STk> (ask nasty 'go-directly-to bh-office)


nasty moved from sproul-plaza to bh-office
""
appeared
STk> (ask nasty 'notice brian)

nasty took cake

Yaaah! brian is upset!
"What's your favorite programming language?"
scheme
"Good answer, but my favorite is Logo!"


nasty moved from bh-office to art-gallery
appeared
STk> (load "obj.scm")
okay
STk> (load "adv.scm")
okay
STk> (load "tables.scm")
okay
STk> (load "adv-world.scm")
"My funny valentine, sweet comic valentine"
"There are tie-dyed shirts as far as you can see..."

oski took bagel

oski took bagel
okay
STk> (define cake (instantiate food 'cake))
cake
STk> (ask bh-office 'appear cake)
appeared
STk> (ask brian 'take cake)

brian took cake
taken
STk> (ask brian 'go-directly-to jail)
"What's your favorite programming language?"
scheme
"Good answer, but my favorite is Logo!"


brian moved from bh-office to jail
appeared
STk> (ask brian 'look-around)
(cake)
STk> (ask nasty 'go-directly-to jail)


nasty moved from sproul-plaza to jail
""
appeared
STk> (ask nasty 'look-around)
(cake brian)
STk> (ask nasty 'notice brian)

nasty took cake

Yaaah! brian is upset!
Can't leave the area.okay
STk> (ask nasty 'look-around)
(cake brian)
STk> (ask brian 'look-around)
(cake nasty)


/home/aa/projects/scheme/lib/stk/4.0.1-ucb1.16/SunOS-5.9-sun4/stk -load /home/aa/projects/scheme/lib/stk/site-scheme/load-simply
Welcome to the STk interpreter version 4.0.1-ucb1.16 [SunOS-5.9-sun4]
Copyright (c) 1993-1999 Erick Gallesio - I3S - CNRS / ESSI <eg@unice.fr>
Modifications by UCB EECS Instructional Support Group
Questions, comments, or bug reports to <inst@EECS.Berkeley.EDU>.
STk> (load "obj.scm")
okay
STk> (load "adv.scm")
okay
STk> (load "tables.scm")
okay
STk> (load "adv-world.scm")
"My funny valentine, sweet comic valentine"
"There are tie-dyed shirts as far as you can see..."

oski took bagel

oski took bagel
okay
STk> (define abc (instantiate food 'abc))
abc
STk> (ask bh-office 'appear abc)
appeared
STk> (ask brian 'look-around)
(abc)
STk> (ask brian 'take abc)

brian took abc
taken
STk> (ask nasty 'go-directly-to art-gallery)


nasty moved from sproul-plaza to art-gallery
appeared
STk> (ask brian 'go east)
*** Error:
    unbound variable: east
Current eval stack:
__________________
  0    (ask brian (quote go) east)
STk> (ask brian 'go 'east)
"What's your favorite programming language?"
scheme
"Good answer, but my favorite is Logo!"


brian moved from bh-office to art-gallery

nasty took abc

Yaaah! brian is upset!


nasty moved from art-gallery to soda
appeared


Question B7.


/home/aa/projects/scheme/lib/stk/4.0.1-ucb1.16/SunOS-5.9-sun4/stk -load /home/aa/projects/scheme/lib/stk/site-scheme/load-simply
Welcome to the STk interpreter version 4.0.1-ucb1.16 [SunOS-5.9-sun4]
Copyright (c) 1993-1999 Erick Gallesio - I3S - CNRS / ESSI <eg@unice.fr>
Modifications by UCB EECS Instructional Support Group
Questions, comments, or bug reports to <inst@EECS.Berkeley.EDU>.
STk> (load "obj.scm")
okay
STk> (load "adv.scm")
okay
STk> (load "tables.scm")
okay
STk> (load "adv-world.scm")
"My funny valentine, sweet comic valentine"
"There are tie-dyed shirts as far as you can see..."

oski took bagel

oski took bagel
okay
STk> (define cookie (instantiate food 'cookie))
cookie
STk> (define moca (instantiate food 'moca))
moca
STk> (define bike (instantiate thing 'bike))
bike
STk> (ask bh-office 'appear moca)
appeared
STk> (ask bh-office 'appear cookie)
appeared
STk> (ask art-gallery 'appear bike)
appeared
STk> (ask brian 'take moca)

brian took moca
taken
STk> (ask brian 'go 'east)
"What's your favorite programming language?"
scheme
"Good answer, but my favorite is Logo!"


brian moved from bh-office to art-gallery
Police: you may stay.appeared
STk> (ask brian 'look-around)
(moca bike johnny)
STk> (ask nasty 'go-directly-to bh-office)


nasty moved from sproul-plaza to bh-office
appeared
STk> (ask nasty 'look-around)
(cookie)
STk> (ask brian 'go 'west)


brian moved from art-gallery to bh-office

nasty took moca

Yaaah! brian is upset!
"What's your favorite programming language?"
scheme
"Good answer, but my favorite is Logo!"


nasty moved from bh-office to art-gallery

Crime Does Not Pay.
johnny took moca

Yaaah! nasty is upset!


nasty moved from art-gallery to jail
appeared



Question B8



/home/aa/projects/scheme/lib/stk/4.0.1-ucb1.16/SunOS-5.9-sun4/stk -load /home/aa/projects/scheme/lib/stk/site-scheme/load-simply
Welcome to the STk interpreter version 4.0.1-ucb1.16 [SunOS-5.9-sun4]
Copyright (c) 1993-1999 Erick Gallesio - I3S - CNRS / ESSI <eg@unice.fr>
Modifications by UCB EECS Instructional Support Group
Questions, comments, or bug reports to <inst@EECS.Berkeley.EDU>.
STk> (load "obj.scm")
okay
STk> (load "adv.scm")
okay
STk> (load "tables.scm")
okay
STk> (load "adv-world.scm")
"My funny valentine, sweet comic valentine"
"There are tie-dyed shirts as far as you can see..."

oski took bagel

oski took bagel
okay
STk> (define moca (instantiate food 'moca))
moca
STk> (define cookie (instantiate food 'cookie))
cookie
STk> (define bike (instantiate thing 'bike))
bike
STk> (define cellphone (instantiate thing 'cellphone))
cellphone
STk> (ask bh-office 'appear moca)
appeared
STk> (ask bh-office 'appear cellphone)
appeared
STk> (ask brian 'take cellphone)

brian took cellphone
taken
STk> (ask brian 'take moca)

brian took moca
taken
STk> (ask art-gallery 'appear bike)
appeared
STk> (ask art-gallery 'appear cookie)
appeared
STk> (ask brian 'go 'east)
"What's your favorite programming language?"
scheme
"Good answer, but my favorite is Logo!"


brian moved from bh-office to art-gallery
Police: you may stay.appeared
STk> (ask nasty 'go-directly-to bh-office)


nasty moved from sproul-plaza to bh-office
appeared
STk> (ask nasty 'look-around)
()
STk> (ask brian 'go 'west)


brian moved from art-gallery to bh-office

nasty took moca

Yaaah! brian is upset!
"What's your favorite programming language?"
scheme
"Good answer, but my favorite is Logo!"


nasty moved from bh-office to art-gallery

Crime Does Not Pay.
johnny took moca

Yaaah! nasty is upset!


nasty moved from art-gallery to jail
appeared
STk> (ask brian 'look-around)
(cellphone)
STk> (ask brian 'take cellphone)
*** Error:
    You already have it!
Current eval stack:
__________________
  0    (apply stk-error args)
STk> (ask brian 'go 'east)
"What's your favorite programming language?"
scheme
"Good answer, but my favorite is Logo!"


brian moved from bh-office to art-gallery
Police: you may stay.appeared
STk> (ask brian 'look-around)
(cellphone moca cookie bike johnny)
STk> (ask police 'take bike)

johnny took bike
taken
STk> (ask police 'take cookie)

johnny took cookie
taken
STk> (ask brian 'take cookie)
brian is too weak to take the cookie

okay
STk> (ask police 'take cellphone)

johnny took cellphone

Yaaah! brian is upset!
taken

End of transcipt part b.
|#
#|
okay
STk> (load "load-adv")
"My funny valentine, sweet comic valentine"
"Praise the Lord"
"My funny valentine, sweet comic valentine"

oski took bagel

oski took bagel
okay
STk> (define fuzz (instantiate police 'fuzz noahs))
"Would you like lox with it?"
fuzz
STk> (ask fuzz 'money)
100
STk> (ask fuzz 'buy 'bagel)

fuzz took bagel
taken
STk> (ask fuzz 'money)
100
STk> (define joe-schmoe (instantiate person 'joe noahs))
"Would you like lox with it?"
Police: you may stay.joe-schmoe
STk> (ask joe-schmoe 'money)
100
STk> (ask joe-schmoe 'buy 'bagel)

joe took bagel
taken
STk> (ask joe-schmoe 'money)
99.0
STk> (transcript-off)
|#





